<?


function sendInviteEmail($email_address, $ticket) {

	$invite_url = 'http://endeepen.com/login?ticket=' . $ticket . '&return_url=' . urlencode('http://endeepen.com/setup');

	$INVITE_EMAIL_TEMPLATE = "This is your ticket to your very own daylife pages alpha instance. \nClick here to get to your topic pages : $invite_url";
	
	$subject = "Daylife Pages Alpha: Sneak Peek";
	$body = $INVITE_EMAIL_TEMPLATE;
	$cc = NULL;
	$bcc = 'developer@daylife.com';
	
	sendEmail($email_address, $subject, $body, $cc, $bcc);
	
}

function sendEmail($email_address, 
					$subject=NULL, 
					$body=NULL, 
					$cc=NULL,
					$bcc=NULL) {

			include_once ('Mail.php');

			// XXX: Get the smtp address from a config param
			$smtp =  array ("host"=>"127.0.0.1",
					"localhost"=>"daylife");
			$mail = Mail::factory("smtp",$smtp);
		        
            $from_address = "Daylife Topic Pages <noreply@daylife.com>";
                                	
			$headers = array ("From"=>$from_address,
					"To"=>$email_address,
					"Subject"=>$subject,
					"MIME-Version"=>"1.0",
					"cc" => $cc,
					"bcc" => $bcc,
					);  
			
			$recipients = array($email_address, $bcc);
			$mail->send($recipients,$headers,$body);
			$success = true;


}

?>
